#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int x, y;
	y = 0;
	scanf("%d", &x);
	if (x < 2)
	{
		y = 3 * x * x + x;
		printf("%d", y);
	}
	else
	{
		y = 4 * x + 7;
		printf("%d", y);
	}
	return 0;
}